package com.mzj.saas.jobs.bill.repository;

import com.mzj.saas.jobs.bill.entity.SmartLockPwd;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface SmartLockPwdRepository extends PagingAndSortingRepository<SmartLockPwd, Long>, JpaSpecificationExecutor<SmartLockPwd> {
    @Transactional
    void deleteByLockAuthId(Long lockAuthId);

    SmartLockPwd findByLockAuthId(Long lockAuthId);

    List<SmartLockPwd> findByLockId(Long lockId);

    SmartLockPwd findByLockAuthIdAndType(Long lockAuthId, Integer type);

    SmartLockPwd findByLockAuthIdAndPwdIndex(Long lockAuthId, Integer pwdIndex);
    
    SmartLockPwd findByLockIdAndPwdIndex(Long lockId, Integer pwdIndex);
    
    SmartLockPwd findByLockIdAndPwdIndexNum(Long lockId, Integer pwdIndexNum);

    int deleteByLockId(Long lockId);

}
